<template>
  <div class="dialog_box">
    <el-dialog title="签名" :close-on-click-modal="false" v-model="isShowDialog" center width="800px">
      <div>
        <Signin ref="signinRef" @setsign="setsignin"/>
      </div>
      <template #footer>
				<span class="dialog-footer">
					<el-button @click="onCancel" size="small">取 消</el-button>
					<el-button type="primary" @click="onSubmit" size="small">确 认</el-button>
				</span>
      </template>
    </el-dialog>
  </div>
</template>

<script setup lang="ts">
import {ref, reactive, toRefs, onMounted, defineEmits} from 'vue'
import Signin from '../../../components/Esign/index.vue'

const isShowDialog = ref(false)
const emit = defineEmits(['update'])
const signin = ref()
const signinRef = ref()
const openDialog = () => {
  if (signinRef.value) {
    signinRef.value.handleReset()
  }
  isShowDialog.value = true
}
const onCancel = () => {
  isShowDialog.value = false
}
const setsignin = (img: any) => {
  signin.value = img
}

const onSubmit = () => {
  console.log(signinRef.value)
  isShowDialog.value = false
  const param = {
    name: signin.value,
  }
  emit('update', param)
}
defineExpose({
  isShowDialog,
  openDialog,
  onCancel,
  onSubmit,
})
</script>
<style scoped lang="scss">

</style>